//
//  MainVC+UI.swift
//  MedicalUnionHybrid
//
//  Created by 来 on 2019/9/19.
//  Copyright © 2019 EWell. All rights reserved.
//

import Foundation

extension MainVC {
    
    func initUI() {
        
        self.view.backgroundColor = EWEDarkMode.white()
        
        childVCSV = UIScrollView.init()
        if #available(iOS 11.0, *) {
            childVCSV.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        childVCSV.contentSize = CGSize.init(width: UIDevice.lgf_ScreenW * 5.0, height: UIDevice.lgf_ScreenH)
        childVCSV.showsVerticalScrollIndicator = false
        childVCSV.showsHorizontalScrollIndicator = false
        childVCSV.alwaysBounceVertical = false
        childVCSV.alwaysBounceHorizontal = false
        childVCSV.isScrollEnabled = false
        if #available(iOS 11.0, *) {
            childVCSV.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        view.addSubview(childVCSV)
        childVCSV.snp.makeConstraints { (make) in
            make.edges.equalToSuperview().inset(UIEdgeInsets.init(top: 0, left: 0, bottom: 52 + (UIDevice.lgf_IsIphoneX() ? 22.0 : 0.0), right: 0))
        }
        
        tabBar = UIView.init()
        tabBar.backgroundColor = UIColor.clear
        self.view.addSubview(tabBar)
        tabBar.snp.makeConstraints { (make) in
            make.bottom.left.right.equalToSuperview()
            make.height.equalTo(52 + 20 + (UIDevice.lgf_IsIphoneX() ? 22.0 : 0.0))
        }
        
        let ssview = UIView.init()
        ssview.backgroundColor = EWEDarkMode.white()
        tabBar.addSubview(ssview)
        ssview.snp.makeConstraints { (make) in
            make.left.right.bottom.equalToSuperview()
            make.height.equalTo(52 + (UIDevice.lgf_IsIphoneX() ? 22.0 : 0.0))
        }
        
        let line = UIView.init()
        line.backgroundColor = EWEDarkMode.color_F1F2F4()
        tabBar.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(ssview)
            make.height.equalTo(0.5)
        }
        
        let hz = LGFImageTitleView.init(UIImage(named: "tab_1_normal")!, UIImage(named: "tab_1_sel")!, EWEDarkMode.c_0F88F2, "课程", CGSize.init(width: 20, height: 20), 6)
        hz.tag = 0
        hz.delegate = self
        ssview.addSubview(hz)
        hz.isSelect = true
        hz.snp.makeConstraints { (make) in
            make.left.equalToSuperview()
            make.top.equalToSuperview()
            make.width.equalTo(UIDevice.lgf_ScreenW / 5)
            make.height.equalTo(52)
        }
        
        
        let gz = LGFImageTitleView.init(UIImage(named: "-_bingren")!,UIImage(named: "huuanzhesel")!, EWEDarkMode.c_0F88F2, "患者", CGSize.init(width: 20, height: 20), 6)
        gz.tag = 1
        gz.delegate = self
        ssview.addSubview(gz)
        gz.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(UIDevice.lgf_ScreenW / 5)
            make.top.equalToSuperview()
            make.width.equalTo(UIDevice.lgf_ScreenW / 5)
            make.height.equalTo(52)
        }
        
        let sb = LGFImageTitleView.init(UIImage(named: "gznormal")!, UIImage(named: "tab_3_sel")!, EWEDarkMode.c_0F88F2, "工作", CGSize.init(width: 20, height: 20), 6)
        sb.tag = 2
        sb.delegate = self
        ssview.addSubview(sb)
        sb.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(UIDevice.lgf_ScreenW / 5 * 2)
            make.top.equalToSuperview()
            make.width.equalTo(UIDevice.lgf_ScreenW / 5)
            make.height.equalTo(52)
        }
        
        let sc = LGFImageTitleView.init(UIImage(named: "caijinormal")!, UIImage(named: "caijisel")!, EWEDarkMode.c_0F88F2, "采集", CGSize.init(width: 20, height: 20), 6)
        sc.tag = 3
        sc.delegate = self
        ssview.addSubview(sc)
        sc.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(UIDevice.lgf_ScreenW / 5 * 3)
            make.top.equalToSuperview()
            make.width.equalTo(UIDevice.lgf_ScreenW / 5)
            make.height.equalTo(52)
        }
        
        let wd = LGFImageTitleView.init(UIImage(named: "wodenormal")!,UIImage(named: "wodesel")!, EWEDarkMode.c_0F88F2, "我的", CGSize.init(width: 20, height: 20), 6)
        wd.tag = 4
        wd.delegate = self
        ssview.addSubview(wd)
        wd.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(UIDevice.lgf_ScreenW / 5 * 4)
            make.top.equalToSuperview()
            make.width.equalTo(UIDevice.lgf_ScreenW / 5)
            make.height.equalTo(52)
        }
        
        items = [hz, gz, sb, sc, wd]
    }

}
